package com.geekaca.d4.work1;

import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.Period;

public class From1997 {
    public static void main(String[] args) {
        LocalDate date1997 = LocalDate.of(1997,10,1);
        LocalDate today = LocalDate.now();

        // 方式1 分别求到1970,1,1 的天数,然后相减
        long days = today.toEpochDay() - date1997.toEpochDay();
        System.out.println(days);

        // 方式2 通过Duration工具类
        LocalDateTime dateTime1997 = LocalDateTime.of(1997,10,1,0,0,0);
        LocalDateTime today2 = LocalDateTime.now();
        Duration duration = Duration.between(dateTime1997,today2);
        System.out.println(duration.toDays());



    }
}
